import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [{
      path: '/',
      name: 'home',
      component: resolve => require(['../views/login'], resolve)
    },
    {
      path: '/login',
      name: 'login',
      component: resolve => require(['../views/login'], resolve)
    },
    {
      path: '/index',
      name: 'index',
      redirect: "/index/home", //默认显⽰的children地址
      component: resolve => require(['../views/index.vue'], resolve),
      children: [{
          path: 'home',
          name: '欢迎⻚',
          component: resolve => require(['../views/index/home.vue'], resolve),
        }, {
          path: '/teacher',
          name: '⽤户管理',
          component: resolve => require(['../views/teacher'], resolve),
        },
        {
          path: '/system/menu',
          name: '菜单管理',
          component: resolve => require(['../views/system/menu'], resolve),
        },
        {
          path: '/system/role',
          name: '角色管理',
          component: resolve => require(['../views/system/role'], resolve),
        },
      ]
    },
    {
      path: '/*',
      name: '404',
      component: () => import( /* webpackChunkName: "404" */ '../views/ErrorView.vue')
    }
  ]
})

